const Sequelize = require('sequelize')
let db = require('../config/db')
let User = require('./user')
let Task = require('./task')

let Task_img = db.define('task_img',{
    id:{
        type: Sequelize.INTEGER,
        field: 'id',
        primaryKey:true,
        autoIncrement: true,
        comment: "主键，自增"
    },
    uid:{
      type:Sequelize.INTEGER,
      comment:'用户id'
    },
    task_id:{
        type: Sequelize.INTEGER,
        field: 'task_id',
    },
    img1:{
        type:Sequelize.STRING,
    },
    img2:{
        type:Sequelize.STRING,
    },
    img3:{
        type:Sequelize.STRING,
    },
    deletedAt: {
        type: Sequelize.DATE,
        get() {
            return moment(this.getDataValue('deletedAt')).format('YYYY-MM-DD HH:mm:ss');
        }
    },
    createdAt: {
        type: Sequelize.DATE,
        get() {
            return moment(this.getDataValue('createdAt')).format('YYYY-MM-DD HH:mm:ss');
        }
    },
    updatedAt: {
        type: Sequelize.DATE,
        get() {
            return moment(this.getDataValue('updatedAt')).format('YYYY-MM-DD HH:mm:ss');
        }
    },
    isDel:{
        type: Sequelize.INTEGER,
        defaultValue:0,
        comment:'状态，是否删除'
    }
},{
    freezeTableName:true,
    paranoid:true,
    timestamps:true
})


let task_img = Task_img.sync();
module.exports = Task_img
